package org.visionlibrary.image.filters.effects;

import java.awt.Point;

import javax.media.jai.TiledImage;

import org.visionlibrary.image.model.WindowFilter;


public class Solarization extends WindowFilter {
	protected int width = 1;
	protected int height = 1;

	@Override
	protected int getNewPixelVal(TiledImage src, Point p, int channel) {
		int px = src.getSample(p.x, p.y, channel); // jak wyluskac maksymalna
		// wartosc? zakladam ze 255
		//TODO Poprawic maksymalna wartosc
		return (px > ((255 * p.x) / (2 * src.getWidth())) ? px : 255 - px);
	}

	@Override
	protected void setWindowProperties() {
		windowWidth = width;
		windowHeight = height;
		dstPointInWindow = new Point(width / 2, height / 2);
	}
}
